Skip to content

Conversation

@daun
Copy link
Contributor

@daun daun commented Apr 7, 2025

Currently, there is no way of using a dynamic counter name in the increment tag. Dynamic variable names don't seem to work as tag methods. This PR adds a counter param to allow dynamic counter names. Tests are added.

Does not work

{{ articles }}
  {{ increment:@category }}st article in category {{ category }}
{{ /article }}

Will now work

{{ articles }}
  {{ increment :counter="category" }}st article in category {{ category }}
{{ /article }}

@jasonvarga jasonvarga merged commit c1d0932 into statamic:5.x Apr 9, 2025
25 checks passed
@daun daun deleted the feature/dynamic-increment-counter branch April 9, 2025 20:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants